/**
 * 封装at的Overlay.Popup，给其背景、padding等
 */

import React from 'react';
import PropTypes from 'prop-types';
import { Overlay } from '@teamix/ui';
import './index.scss';

export default class CodePopup extends React.Component {
  static propTypes = {
    size: PropTypes.oneOf(['large', 'medium']), // FIXME 目前横向支持两种宽度，待统一治理时改为纵向
    footer: PropTypes.node,
  };

  static defaultProps = {
    size: 'medium',
  };

  prefix = 'code-popup';

  render() {
    const { size, footer, children, ...others } = this.props;
    return (
      <Overlay.Popup {...others}>
        <div className={`${this.prefix} ${this.prefix}-${size} overlay-shadow`}>
          <div className={`${this.prefix}-body`}>{children}</div>
          {footer ? <div className={`${this.prefix}-footer`}>{footer}</div> : null}
        </div>
      </Overlay.Popup>
    );
  }
}
